<div id="maincontent">

<%= render :partial => "shared_common_files/data_area_help_bar" %>

<h2>User</h2>

<!-- OpenApp Built Search Panel starts -->


 <div >
      <%= start_form_tag ({:action => 'search'},{:class => 'appform'}) %>
      
 <%=renderSearchPanel({"controller"=>"user", "action"=>"search"}, [{"label"=>"Login", "name"=>"login"},
                                                                    {"label"=>"First Name", "name"=>"firstname"},
                                                                    {"label"=>"Last Name", "name"=>"lastname"},
                                                                    {"label"=>"Email", "name"=>"emailaddress"}])%>

<%= end_form_tag %>
 	 </div>

<!-- OpenApp Built Search Panel ends-->


<h5>List of users in your company</h5>	
  
    <% for name in [:notice, :warning, :message] %>
    <% if flash[name] %>
      <%= "<div class='message-justmsg'> #{flash[name]} </div>" %>
    <% end %>
  <% end %>

<div class="list">
	<table>
		<tr>
			<td class="pagination" colspan="5"> 
			<%= pagination_links @user_pages %>
			</td>
		</tr>
			<% for column in @content_columns %>
			    <th><%= column.human_name %></th>
			<% end %>
			<th>Actions</th>

	<% count=1%>	  
	 <% rowtype="odd"%>
	<% for user in @users_by_org_id %>
  
	  <%if(isodd(count))%>
	     <% rowtype="odd"%>
	  <%else%>
	    <% rowtype="even"%>
	  <%end%>     
	  <tr class="<%=rowtype%>">
	  <% for column in @content_columns %>
	     <td> <%=h user.send(column.name) %> </td>
	  <% end %>

        <td>
        <%= link_if_authorized image_tag('/themes/odotclassic/images/show.png', :title => 'Details' ), {:action => 'show', :id => user}%>
        <%= link_if_authorized image_tag('/themes/odotclassic/images/edit.png', :title => 'Edit'), {:action => 'edit_user', :id => user}%>
        <% if authorized?(:action => 'delete_user') && (user.login != UserEngine.config(:admin_login)) %>
            <%= link_to image_tag('/themes/odotclassic/images/delete.png', :title => 'Delete') , {:action => 'delete_user', :id => user} , {:confirm => "Are you sure you want to delete user?"}%>
        <% end %>
        
        </td>

  </tr>
  <% count = count + 1 %>
<% end %>

	</table>
</div>


<br/><br/><br/><br/><br/><br/><br/>

<div class="list">

    <%= start_form_tag({:action => 'new'}, {:method=>'get'}) %>
    
	<table>
	     <th>Actions</th>
         <tr class="even">
            <td>
               <%= image_submit_tag "/themes/odotclassic/images/btn_createuser.gif", :alt => 'Create User', :border => 0 %>
				<%= link_if_authorized image_tag('/themes/odotclassic/images/btn_cancel.gif', :alt =>'Cancel'), {:controller => "/controlpanel" ,:action => 'list'}  %>
            </td>
         </tr>        
	</table>
    <input type="hidden" name="cid" value="<%=current_user.organization_id%>"/>
    <%= end_form_tag %>
	<br/>
</div>

</div>



